package com.bank.basic.pojo;

import com.bank.common.resultUtil.ResultCodeEnum;
import com.bank.common.stringUtil.StringUtil;

import java.util.Map;

/**
 * The type Data com.bank.user.handler.
 *
 * @author Cejay1314
 * @version 1.0
 * @create 2023 /2/18 19:54
 */
public class DataHandler implements AuthorityHandler{
    private AuthorityHandler next;


    /**
     * Instantiates a new Data com.bank.user.handler.
     */
    public DataHandler() {
    }

    /**
     * Instantiates a new Data com.bank.user.handler.
     *
     * @param next the next
     */
    public DataHandler(AuthorityHandler next) {
        this.next = next;
    }

    @Override
    public void setNext(AuthorityHandler authorityHandler) {
        this.next = authorityHandler;
    }

    @Override
    public ResultCodeEnum handle(String data) {
        Map<String,Object> dataMap = StringUtil.getInstance().stringTransformIntoMap(data);
        dataMap.get("id");
        if(next!=null){
            return next.handle(dataMap.toString());
        }
        return ResultCodeEnum.SUCCESS;
    }
}
